<div data-role="page" id="article<?php echo $structure->getFId() ?>">
    <script type="text/javascript">
        $(function() {
            $('#shareShareLink').live('click', function() {
                $("#addPlusPanel").toggle('fast', function() {

                });
            });
            $('#addFavourite').live('click', function() {
                $.ajax({
                    type : 'POST',
                    url : "/m/addFavourite",
                    dataType : 'json',
                    cache: false,
                    data: {
                        pageId : '<?php echo $structure->getFId(); ?>'
                    },
                    success : function(data) {
                        alert("Add Favourite Successful.");
                    },
                    error : function(XMLHttpRequest, textStatus, errorThrown) {
                        //alert("Your login attempt was not successful. Please try again.");
                    }
                });
            });


            $('.content a').not("#addFavourite, #shareShareLink, #mailLink").bind('click', function(ev) {
                var objectName = $(this).attr('href').replace("#", "");
                if ($($("[name=" + objectName + "]")).length) {
                    var target = $("[name=" + objectName + "]").get(0).offsetTop;
                    $.mobile.silentScroll(target);
                    return false;
                }
            });
        });
    </script>


    <div id="header<?php if ($level1Id == 2) echo "_tc" ?>">
        <?php if ($headerLogo != "") { ?>
            <a href="/m/landing?article=<?php echo $level1Id ?>" data-ajax="false">
    	        <img src="/uploads/<?php echo $headerLogo ?>" class="logo" onerror="this.src='/images/mobile/not_available.gif';"/>
            </a>
        <?php } ?>
        <a href="/m/navigation?articleId=<?php echo $structure->getFId() ?>" data-ajax="false" class="ui-btn-right"><img src="/images/mobile/btn_menu.png" class="menu" style="<?php if ($level1Id == 2) echo "top: 25px" ?>"/></a>
    </div>

    <div class="content" data-role="content" style="min-height:400px">
        <?php if ($structure->getFImageDraft() == "" && $structure->getFImage() == "") {
            //show nothing
        } else {
        ?>

        <table width="100%" cellpadding="0" cellspacing="0">
            <tr align="center">
                <td>

                    <img src="/uploads/<?php
                        if ($isDraft == "Y")
                            echo $structure->getFImageDraft();
                        else
                            echo $structure->getFImage();
                    ?>" onerror="this.src='/images/mobile/not_available.gif';"/>

                </td>
            </tr>
        </table>
        <?php } ?>
        <div id="tu_content_text">
        <!--<span class="page_title"><?php /*echo $structure->getFName() */?></span><br />-->
        <?php
            if ($isDraft == "Y")
                echo $structure->getFContentDraft();
            else
                echo $structure->getFContent();
        ?>
		</div>

        <table width="100%" cellpadding="0" cellspacing="0">
            <tr align="center">
                <td>
                    <div style="width: 210px">
                        <div id="shareFavorite" style="width:60px; float: left;padding: 4px">
                            <a href="#" id="addFavourite" data-ajax="false" data-inline="true" data-rel="dialog" data-transition="pop" style="text-decoration: none; color: #808080;">
                                <img src="/images/mobile/icon_favorite.png" /><br />
                                Favorite</div>
                            </a>
                        <div id="shareShare" style="width:60px; float: left;padding: 4px">
                            <a href="#" id="shareShareLink" data-ajax="false" data-inline="true" data-rel="dialog" data-transition="pop" style="text-decoration: none; color: #808080;">
                                <img src="/images/mobile/icon_share.png" /><br />
                                Share</div>
                            </a>
                        <div id="shareEmail" style="width:60px; float: left;padding: 4px">
                            <a id="mailLink" href="mailto:?body=<?php echo $structure->getFLink(); ?>" data-ajax="false" style="text-decoration: none; color: #808080;">
                                <img src="/images/mobile/icon_email.png" /><br />&nbsp;Email
                            </a>
                        </div>
                        <div class="clear"></div>
                    </div>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="3">
                    <div style="display: none; width: 400px" id="addPlusPanel">
                        <?php echo $tblSetting->getFValue(); ?>
                    </div>
                </td>
            </tr>
        </table>


        <div style="padding: 10px">
        <?php if ($structure->getChildrenLinkType() == "combo") {
                    if (count($tbl_structures) > 0) {
            ?>
            <style type="text/css">
                .ui-content .ui-listview {
                    margin: 0px;
                    margin-bottom: -15px;
                    margin-left: -15px;
                    margin-right: -15px;
                }
                .ui-dialog .ui-content, .ui-dialog .ui-footer {
                    margin-top: -30px;
                }
            </style>
            <script type="text/javascript">
                $(function() {
                    $('#selectLink').live('change', function() {
                        var link = $(this).val();
                        var articleId = $("#selectLink option:selected").attr("refId");
                        var externalLink = $("#selectLink option:selected").attr("externalLink");
                        setTimeout(function(){
                            if (externalLink == 2) {
                                window.open (link,"taylor");
                            } else {
                                $("#enquiryForm").attr("action", link);
                                $("#articleId").val(articleId);
                                $("#enquiryForm").submit();
                            }
                        },500);
                    });
                });
            </script>
            <form action="forms-sample-response.php" id="enquiryForm" method="get" data-ajax="false">
                <input type="hidden" name="articleId" id="articleId">
                <select name="select-choice-11" id="selectLink" data-theme="a" data-icon="gear" data-inline="true" data-native-menu="false">
                    <option>Please select one</option>
                    <?php
                    foreach ($tbl_structures as $tbl_structure):
                        if($tbl_structure->getFContent()=="") {
                            //do not load the menu
                        } else {
                            $link = "/m/article?articleId=".$tbl_structure->getFId();
                            if ($tbl_structure->getExternalLink() != "0")
                                $link = $tbl_structure->getFLink();
                    ?>
                        <option value="<?php echo $link ?>" externalLink="<?php echo $tbl_structure->getExternalLink() ?>" refId="<?php echo $tbl_structure->getFId() ?>"><?php echo $tbl_structure->getFname() ?></option>
                    <?php }
                    endforeach; ?>
                </select>
            </form>
            <?php  }
            } else if ($structure->getChildrenLinkType() == "list") { ?>
            <ul data-role="listview" data-inset="true" data-theme="a">
            <?php foreach ($tbl_structures as $tbl_structure):
                if($tbl_structure->getFContent() == "" && $tbl_structure->getFIcon() == "" && $tbl_structure->getFImage() == "") {
                    //do not load the menu
                } else {
                    $link = "/m/article?articleId=".$tbl_structure->getFId();
                    $target = "_self";
                    if ($tbl_structure->getExternalLink() == "1") {
                        $link = $tbl_structure->getFLink();
                        $target = "_blank";
                    } else if ($tbl_structure->getExternalLink() == "2") {
                        $link = $tbl_structure->getFLink();
                    }
            ?>
                <li><a href="<?php echo $link ?>" data-ajax="false" target="<?php echo $target ?>"><?php echo $tbl_structure->getFname() ?></a></li>
            <?php }
            endforeach; ?>
            </ul>
        <?php } else {
                    foreach ($tbl_structures as $tbl_structure):
                        if($tbl_structure->getFContent() == "") {

                        } else {


                            $link = "/m/article?articleId=".$tbl_structure->getFId();
                            $target = "_self";
                            if ($tbl_structure->getExternalLink() == "1") {
                                $link = $tbl_structure->getFLink();
                                $target = "_blank";
                            } else if ($tbl_structure->getExternalLink() == "2") {
                                $link = $tbl_structure->getFLink();
                            }
                            echo "<a data-ajax='false' href='".$link."' target='".$target."'>".$tbl_structure->getFname()."</a><p>";
                        }
                    endforeach;
              } ?>
        </div>
	</div>

	<div id="footer_content" style="text-align: center;">
        <div class="footer_link">
            <?php
            $count = 0;
            foreach ($footer_menus as $tbl_structure):
                if($tbl_structure->getFContent()=="") {
                    //show nothing
                } else {
                    $link = "/m/article?articleId=".$tbl_structure->getFId();
                    $target = "_self";
                    if ($tbl_structure->getExternalLink() == "1") {
                        $link = $tbl_structure->getFLink();
                        $target = "_blank";
                    } else if ($tbl_structure->getExternalLink() == "2") {
                        $link = $tbl_structure->getFLink();
                    }

                    $breakline = "";
                    //if ($count != 0)
                        $breakline = "<span style='color: #FFFFFF; font-family: Arial,Helvetica,sans-serif;font-size: 11px; font-weight: normal; text-shadow: 0 0px 0 #FFFFFF'>|</span>";
                    //$count++;
                ?>
                    <a href="<?php echo $link ?>" target="<?php echo $target ?>" data-ajax="false" style="color: #FFFFFF; font-family: Arial,Helvetica,sans-serif;font-size: 11px; font-weight: normal; text-shadow: 0 0px 0 #FFFFFF"><?php echo $tbl_structure->getFName(); ?></a>
                    <?php echo $breakline; ?>
            <?php } endforeach; ?>
            <a href="<?php echo $level1Link ?>" data-ajax="false" style="color: #FFFFFF; font-family: Arial,Helvetica,sans-serif;font-size: 11px; font-weight: normal; text-shadow: 0 0px 0 #FFFFFF">Desktop Site</a>
        </div>
        <span class="footer_text" style="color: #FFFFFF; font-family: Arial,Helvetica,sans-serif;font-size: 11px; font-weight: normal; text-shadow: 0 0px 0 #FFFFFF">All Rights Reserved © 2012 Taylor's Education Group.</span>
    </div>
</div>